#include <iostream>
#include <memory>
#include <time.h>

// #include "ThreadPool_v1.hpp"
// #include "ThreadPool_v2.hpp"
// #include "ThreadPool_v3.hpp"
#include "ThreadPool_v4.hpp" //把进程池设计成单例

#include "task.hpp"
using namespace std;

const char *op = "+_*/%";

int main()
{
    //获取单例

    // tp->init();
    // tp->start();
    while (true)
    {
        // 充当生产者
         int x,y;
         char op;
         sleep(1);
         cout<<"x= ";
         cin>>x;
         cout<<"y= ";
         cin>>y;
         cout<<"op= ";
         cin>>op;
         Task t(x,y,op);
         ThreadPool<Task>::GetInstance()->PushTask(t); 
         
        // tp->PushTask(Task(rand() % 10 + 1, rand() % 10 + 2, op[rand() % 4]));
    }
    return 0;
}

